//using SendGridMail;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
using Aurora.WebApp.Helpers;
using Aurora.WebApp.Models;
using System.Data.Entity;

namespace Aurora.WebApp.Logic
{
    public class EmailLogic
    {
        private ControllerBase controller;
        private String emailFrom;
        private String emailFromName;

        public EmailLogic(ControllerBase controller)
        {
            this.controller = controller;
            this.emailFrom = ConfigurationManager.AppSettings["SendGird.From"].ToString();
            this.emailFromName = ConfigurationManager.AppSettings["SendGird.FromName"].ToString();
        }

        #region Templates
        /*
        public void SendEmailRegistroF1Evaluador(Ex2Entities context, String TituloExperiencia)
        {
            try
            {
                var myMessage = SendGrid.GetInstance();
                var templateRender = new TemplateRender(controller);
                var credentials = new NetworkCredential("azure_b5dc6c2cd2001c3971ff91198d6be2fa@azure.com", "nqc3rmf3");
                var transportWeb = Web.GetInstance(credentials);

                myMessage.From = new MailAddress(emailFrom, emailFromName);
                myMessage.Subject = "Registro Fase 1";
                myMessage.Html = templateRender.Render("MailRegistroExperienciaF1Evaluador", new { ExperienciaExitosa = TituloExperiencia });

                context.Usuario.Where(x => x.Rol == ConstantHelpers.ROL_EVALUADOR_FASE1).ToList().ForEach(x => myMessage.AddTo(x.Email));

                if (transportWeb != null)
                    transportWeb.DeliverAsync(myMessage);
            }
            catch (Exception ex)
            {
            }
        } 
        */
        #endregion
    }
}